<form id="pass" name="passform" class="form-horizontal" role="form" action="{MOD_URL}&op=password" method="post" onsubmit="editpass_submit(this);return false">
<input type="hidden" name="editpass" value="true" />
<input type="hidden" name="uid" value="$uid" />
<input type="hidden" name="formhash" value="{FORMHASH}" />
	<!--{if $showoldpassword>0}-->
	<div class="row mb-3">
		<label class="col-sm-2" for="password0" required>{lang original_password}</label>
		<div class="col-sm-10">
      <input type="password" name="password0" class="form-control" autocomplete="off" id="password0" placeholder="{lang input_original_password}" data-chk="false">
      <span id="chk_password0" class="help-msg"> <span id="suc_password0"></span> <kbd  class="help-msg"></kbd> </span>
    </div>
	</div>
	<!--{/if}-->
	<div class="row mb-3">
		<label class="col-sm-2" for="password">{lang new_password}</label>
		<div class="col-sm-10">
      <input type="password" name="password" class="form-control" autocomplete="off" id="password" placeholder="" data-chk="false">
      <span id="chk_password" class="help-msg"> <span id="suc_password"></span> <kbd  class="help-msg"></kbd> </span>
    </div>
	</div>
	<div class="row mb-3">
		<label class="col-sm-2" for="password2">{lang new_password_confirm}</label>
		<div class="col-sm-10">
      <input type="password" id="password2" class="form-control" name="password2" autocomplete="off" placeholder="" data-chk="false">
      <span id="chk_password2" class="help-msg"> <span id="suc_password2"></span> <kbd  class="help-msg"></kbd> </span>
    </div>
	</div>
	<!--{if $secqaacheck || $seccodecheck}-->
	<div class="row mb-3 signin-form">
		<label class="col-sm-2">{lang verification_code}</label>
		<div class="col-sm-10">
			<!--{template lyear:seccheck}-->
		</div>
	</div>
	<!--{/if}-->
	<dl class="mb-3 d-grid">
		<input type="submit" class="btn btn-primary btn-round bodyloading" value="{lang save_changes}" >
	</dl>
<script type="text/javascript">
    var pwlength = "{$_G['setting']['pwlength']}";
    var strongpw = eval('{$strongpw}');
    var ignoreEmail = false;
    if( jQuery('#password0').length>0 ){
        jQuery('#password0').on('blur',function(){
            if(jQuery(this).val()==''){
                errormessage(jQuery(this),'{lang please_input_original_password}');
            }else{
				 errormessage(jQuery(this),'');
            }
			   return false;
        });
    }
	checkPwdComplexity(document.getElementById('password'),document.getElementById('password2'));
   
    function editpass_submit(form){
       
       var error=0;
		jQuery(form).find('.help-msg').each(function(){
			if(!jQuery(this).hasClass('chk_right')){
				jQuery(this).parent().find('input').trigger('blur').focus();
				error=1;
				return false;
			}
		});
		if(error) return false;
        var formdata = jQuery(form).serialize();
        var url = jQuery(form).attr('action');
        jQuery.post(url+'&returnType=json',formdata,function(data){
            if(data['success']){
                showmessage(data['success'],'success',1000,1);
                window.setTimeout(function(){
                    location.href='user.php?mod=login&op=logging&action=login';
                },3000);

            }else if(data['error']){
                showmessage(data['error'],'danger',2000,1);
            }
        },'json').fail(function (jqXHR, textStatus, errorThrown) {
            showmessage('操作失败，请稍后再试: ' + textStatus, 'error', 3000, 1);
        });
        return false;
    }
</script>